import os


# print(os.path.exists("ip1.txt"))
# try:
#     with open("ip1.txt", mode='r', encoding="utf-8") as f:
#         print(f.read())
# except Exception as e:
#     print("文件不存在")

def readfile(filename):
    with open(filename, mode="r", encoding="utf-8") as f:
        # print()
        list1 = f.readlines()
    #     [x表达式 for x变量 in 一个范围]
    list2 = [x.split(" ")[0] for x in list1]

    return list2


#
#
# res = readfile("ip.txt")
# print(res)

# is_first = 1
# if is_first:
#     print("第一次运行")
#     is_first = 0
# else:
#     print("不是第一次")
#
# list1 = []
# list1.extend(readfile('ip.txt'))
# print(list1)
import unicodedata

# print("\u4e00")
# print("\u4e2d")
# print(ord("中"))
# print(chr(20013))
# print("中".encode("unicode-escape"))
# print("中".encode("utf-8"))

# print("12\\n44")
# print("final1y)
# print(sum(range(1, 10, 2)))
# x = 3==3, 5
# print(x)
# from functools import reduce
# print(reduce(lambda x, y: x + y, [1, 2, 3]))
import re

# re.search()
from django.core.paginator import Paginator
from django.db.models import query


# b = query.raw("select * from book where name ='三国演义'")
# print(b)
class Teacher:
    def __init__(self, name, sex):
        self.name = name
        self.sex = sex

    def skill(self):
        print("{}的技能是-------吹牛-------".format(self.name))


class Student:
    def __init__(self, name, classno, teacher):
        self.name = name
        self.classno = classno
        self.teacher = teacher

    def study(self):
        print("{} 正在听老师吹牛--------".format(self.name))


kakaxi = Teacher(name="卡卡西", sex="未知")

naleduo = Student(name="鸣人",classno=7,teacher=kakaxi)


print(naleduo.teacher.name)
# print(type(naleduo.teacher))